package com.five.zhh.fiveinfive.room.message.operate;

import com.five.zhh.fiveinfive.room.message.OperateTittle;
import com.five.zhh.fiveinfive.room.message.UserOperate;
import com.five.zhh.fiveinfive.room.user.UserInfoInRoom;
import lombok.Data;

/**
 * 系统操作通知
 * 将系统的某些类型通知：玩家加入、玩家退出、游戏开始、游戏结束、游戏胜利、游戏失败等
 */
@Data
public class SystemOperate extends UserOperate {

    /**
     * 发送给当前用户
     */
    private UserInfoInRoom currentUser;

    /**
     * 操作码
     */
    private int code;

    /**
     * 系统进行了什么操作
     */
    private String operate;

    /**
     * 加入房间成功
     */
    public static final int JOIN_ROOM_SUCCESS = 1;
    /**
     * 玩家准备
     */
    public static final int PLAYER_READY = 2;
    /**
     * 游戏开始
     */
    public static final int GAME_START = 3;
    /**
     * 游戏结束
     */
    public static final int GAME_END = 4;

    /**
     * 落子失败
     */
    public static final int PLAY_CHESS_FAIL = 5;

    /**
     * 告知玩家顺序
     */
    public static final int PLAY_ORDER = 6;

    public static final int FIRST_PLAY = 7;

    public static final int OTHER_JOIN = 8;

    public SystemOperate() {
        super(OperateTittle.SYSTEM);
    }

    public SystemOperate(UserInfoInRoom currentUser, int code, String operate, String roomCode) {
        super(OperateTittle.SYSTEM, roomCode);
        this.currentUser = currentUser;
        this.code = code;
        this.operate = operate;
    }

    public SystemOperate(String roomCode, int code, String operate) {
        super(OperateTittle.SYSTEM, roomCode);
        this.code = code;
        this.operate = operate;
    }
}
